package cloud.song.cloud.consuner.controller;

import cloud.song.cloud.consuner.config.openfeignConfig;
import com.song.cloud.common.entities.CommonResult;
import com.song.cloud.common.entities.Payment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author ZhangGuisong
 * @Date 2021/2/18-21:35
 */
@RestController
public class openfeignController {

      @Autowired
     private   openfeignConfig openfeignConfig;

    @GetMapping("/consumer/payment/query/{id}")
    public CommonResult<Payment> query(@PathVariable("id") Long id){
        CommonResult query = openfeignConfig.query(id);
        if(query!=null){
            return  new CommonResult(200,"数据查询成功"+id,query);
        }else {
            return new CommonResult<>(444,"数据查询失败",null);
        }
    }
    @GetMapping("/consumer/payment/tiemout")
    public String timeOut(){
        String s = openfeignConfig.timeOut();
        return s;
    }
}
